package com.wink.charity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;

import com.google.gson.Gson;
//import com.wink.common.Identity;


@XmlRootElement(name = "charitylist")
public class CharityList {
	@XmlElementRef
	ArrayList<Charity> data;

	/**
	 * must have
	 */
	public CharityList() {
	}

	public CharityList(ArrayList<Charity> data) {
		this.data = data;
	}

	public ArrayList<Charity> getList() {
		return data;
	}

	public void setData(ArrayList<Charity> data) {
		this.data = data;
	}
	
	
	
	
	public static String toJson(CharityList charitylist) {
		Gson gson = new Gson();
		CharityList cl = new CharityList();  
		String json = gson.toJson(charitylist, CharityList.class);		
		System.out.println("---------> ChairtyList: to json  " + json);
		return json;
	}
	
	
	public static CharityList fromJson(String json) {
		Gson gson = new Gson();
		CharityList retCh = gson.fromJson(json, CharityList.class);
		System.out.println("---> CharityList: fromJson  " + retCh.toString());
		return retCh;
	}
	

}
